/**
 *
 *      ___                       ___
 *     /\  \          ___        /\  \
 *    /::\  \        /\  \      /::\  \
 *   /:/\:\  \       \:\  \    /:/\ \  \
 *  /:/  \:\  \      /::\__\  _\:\~\ \  \
 * /:/__/ \:\__\  __/:/\/__/ /\ \:\ \ \__\
 * \:\  \  \/__/ /\/:/  /    \:\ \:\ \/__/
 *  \:\  \       \::/__/      \:\ \:\__\
 *   \:\  \       \:\__\       \:\/:/  /
 *    \:\__\       \/__/        \::/  /
 *     \/__/                     \/__/
 *
 * CIS - Clang Indexing Service is a Project Manager & Source code indexing service
 * created so as to simplify the indexing of C/C++ based source code which use
 * standardized build mechanisms.
 *
 **/

#ifndef INDEXSERVERCONN_HXX
#define	INDEXSERVERCONN_HXX

#include <Poco/Net/TCPServerConnection.h>
#include <Poco/Net/StreamSocket.h>
#include <Poco/Net/SocketStream.h>

namespace cis {

class IndexServerConn : public Poco::Net::TCPServerConnection {
public:

    IndexServerConn(const Poco::Net::StreamSocket& client) : TCPServerConnection(client), socketStream(client) {
    }

    void run();

    virtual ~IndexServerConn();

private:
    long isCompleteRequest(const std::string&) const;

    std::string serveRequest(const std::string& request) const;

    Poco::Net::SocketStream socketStream;
};

}
#endif	/* INDEXSERVERCONN_HXX */

